layui.use(['form', 'layer', 'element', 'jquery'],function(){
    var form = layui.form,
        layer = parent.layer === undefined ? layui.layer : top.layer,
        element = layui.element;
        $ = layui.jquery;



    //外部图标链接
    var iconUrl = "https://at.alicdn.com/t/font_400842_q6tk84n9ywvu0udi.css";
    $.get(iconUrl,function(data){
        var iconHtml = '';
        for(var i=1;i<data.split(".icon-").length;i++){
            iconHtml += "<li class='layui-col-xs4 layui-col-sm3 layui-col-md2 layui-col-lg1'>"+
                            "<i class='seraph icon-" + data.split(".icon-")[i].split(":before")[0] + "'></i>" +
                            "seraph icon-" + data.split('.icon-')[i].split(':before')[0] +
                        "</li>";
        }
        $(".seraphicon").html(iconHtml);
        $(".seraphiconLength").text(data.split(".icon-").length-1);
    });


    //LayUI图标链接
    var layuiiconUrl = "/public/layui/css/layui.css";
    $.get(layuiiconUrl, function (data) {
        var layuiiconHtml = '';
        for (var i = 1; i < data.split(".layui-icon-").length; i++) {
            layuiiconHtml += "<li class='layui-col-xs4 layui-col-sm3 layui-col-md2 layui-col-lg1'>" +
                "<i class='layui-icon layui-icon-" + data.split(".layui-icon-")[i].split(":before")[0] + "'></i>" +
                "layui-icon layui-icon-" + data.split('.layui-icon-')[i].split(':before')[0] +
                "</li>";
        }
        $(".layuiicon").html(layuiiconHtml);
        $(".layuiiconLength").text(data.split(".layui-icon-").length - 1);
    });

    //iconfont图标链接
    var iconfontUrl = "/public/plugin/iconfont/iconfont.css";
    $.get(iconfontUrl, function (data) {
        var iconfontHtml = '';
        for (var i = 1; i < data.split(".icon-").length; i++) {
            iconfontHtml += "<li class='layui-col-xs4 layui-col-sm3 layui-col-md2 layui-col-lg1'>" +
                "<i class='iconfont icon-" + data.split(".icon-")[i].split(":before")[0] + "'></i>" +
                "iconfont icon-" + data.split('.icon-')[i].split(':before')[0] +
                "</li>";
        }
        $(".iconfont").html(iconfontHtml);
        $(".iconfontLength").text(data.split(".icon-").length - 1);
    });



    //图标代码复制
    $("body").on("click",".icons li",function(){
        var copyText = document.getElementById("copyText");
        copyText.innerText = $(this).text();
        copyText.select();
        document.execCommand("copy");
        layer.msg("复制成功",{anim: 2});
    })
});


